-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move sObject Refresh command to apex module and improve telemetry #1236
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1236 +/- ##
===========================================
+ Coverage 70.93% 70.98% +0.04%
===========================================
Files 198 198
Lines 7469 7471 +2
Branches 787 786 -1
===========================================
+ Hits 5298 5303 +5
+ Misses 2013 2010 -3
Partials 158 158
Continue to review full report at Codecov.
|
colorizer_statusbar_hover_text: 'Highlight Apex Code Coverage' | ||
colorizer_statusbar_hover_text: 'Highlight Apex Code Coverage', | ||
force_sobjects_no_refresh_if_already_active_error_text: | ||
'A refresh of your sObject definitions is already underway. If you need to restart the process, cancel the running task.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@brpowell Is it possible to make the change to fetch the files before we start indexing in LSP? Otherwise this change would be a potential source of performance issue since I think an sobject fetch would cause us to reinitialize again. So we would have to run index once at startup and again on an sobject fetch. |
You mean wait for sObject refresh to be done and then initialize the LSP? Or kick it off in parallel? If it's the former I'd say that might be a burden for the user to have to wait for refresh to finish to start using lsp features. |
@praksb @brpowell indexing and recompilations are good things to look out for with these changes. Keep in mind that we don't know how long the fetching of sobjects will take since that'll depend on the org's shape. You can look at existing telemetry to get an idea, but it could be that indexing local code finishes before the sobject fetch call. |
@brpowell I was thinking of the former (wait for sobject refresh to be done not run in parallel). But, I do see your point that the refresh might take a while. We can check this in as is and wait for customer feedback. The possible perf impact should also be minimal since we do a refresh only once now and that too only when the folder didn't exist.
|
@@ -24,6 +24,21 @@ export interface CancellationToken { | |||
isCancellationRequested: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in this file are for improving telemetry data around this command
"type": [ | ||
"boolean" | ||
], | ||
"default": false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed this morning, the default behavior will now be off. The PR is mostly focused on moving the code to the apex extension and improving telemetry data now.
console.log('Generate success ' + result.data); | ||
this.logMetric(commandName, startTime, result.data); | ||
} catch (result) { | ||
console.log('Generate error ' + result.error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now log errors and successes with the number of objects fetched - if the command got far enough to collect that information.
@@ -59,14 +67,10 @@ export async function activate(context: vscode.ExtensionContext) { | |||
} | |||
|
|||
// Telemetry | |||
if (sfdxCoreExtension && sfdxCoreExtension.exports) { | |||
sfdxCoreExtension.exports.telemetryService.showTelemetryMessage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lcampos removed the telemetry message based on our discussion
@@ -205,6 +206,10 @@ | |||
{ | |||
"command": "sfdx.force.apex.test.last.method.run", | |||
"title": "%force_apex_test_last_method_run_text%" | |||
}, | |||
{ | |||
"command": "sfdx.force.internal.refreshsobjects", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are missing porting the command under commandPalette
.
@@ -79,6 +87,29 @@ export class TelemetryService { | |||
} | |||
} | |||
|
|||
public sendErrorEvent( | |||
error: { message: string; stack?: string }, | |||
additionalData?: any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think commandName can be sent as part of additionalData.
Also, is it work deleting the sendError
error method and update the code to use the new sendErrorEvent
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean sendError
in the core module? It has quite a few references, but not a ridiculous amount. I will create separate work for it. I'll modify additionalData though 👍
…into bp/refreshDefault
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…dx-vscode into bp/refreshDefault
What does this PR do?
The command code has been moved to the apex module, and it now kicks off the process once the language server has finished indexing the classes. This is to minimize the language server initialization clashing with pulling down all of the classes. The setting to enable or disable refresh on start is still present, but it is now under the apex configuration. Send additional telemetry data about the refresh process.
What issues does this PR fix or reference?
W-6017035